﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM.HTML
{
    #region Using Statements

    using System;

    #endregion

    /// <summary>
    /// Parameters fed to the OBJECT element. See the PARAM element definition in HTML 4.01.
    /// </summary>
    public class HTMLParamElement : HTMLElement
    {
        #region Constants

        public const string ATTNAME_NAME = "name";
        public const string ATTNAME_TYPE = "type";
        public const string ATTNAME_VALUE = "value";
        public const string ATTNAME_VALUETYPE = "valuetype";

        #endregion

        #region Constructors

        internal HTMLParamElement(Document owner)
            : base(owner, "param")
        {
        }

        #endregion

        #region DOM Level 2 HTML Compliance

        /// <summary>
        /// The name of a run-time parameter. See the name attribute 
        /// definition in HTML 4.01.
        /// </summary>
        public string name
        {
            get
            {
                return getAttribute(ATTNAME_NAME);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(ATTNAME_NAME);
                else
                    setAttribute(ATTNAME_NAME, value);
            }
        }

        /// <summary>
        /// Content type for the value attribute when valuetype has the value 
        /// "ref". See the type attribute definition in HTML 4.01.
        /// </summary>
        public string type
        {
            get
            {
                return getAttribute(ATTNAME_TYPE);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(ATTNAME_TYPE);
                else
                    setAttribute(ATTNAME_TYPE, value);
            }
        }

        /// <summary>
        /// The value of a run-time parameter. See the value attribute 
        /// definition in HTML 4.01.
        /// </summary>
        public string value
        {
            get
            {
                return getAttribute(ATTNAME_VALUE);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(ATTNAME_VALUE);
                else
                    setAttribute(ATTNAME_VALUE, value);
            }
        }

        /// <summary>
        /// Information about the meaning of the value attribute value. 
        /// See the valuetype attribute definition in HTML 4.01.
        /// </summary>
        public string valueType
        {
            get
            {
                return getAttribute(ATTNAME_VALUETYPE);
            }
            set
            {
                if (String.IsNullOrEmpty(value))
                    removeAttribute(ATTNAME_VALUETYPE);
                else
                    setAttribute(ATTNAME_VALUETYPE, value);
            }
        }

        #endregion
    }
}
